/*
 * @Description: 
 * @Author: 葛玉根
 * @Date: 2021-02-25 16:41:59
 * @LastEditTime: 2021-02-26 21:32:28
 * @LastEditors: 葛玉根
 */
import instance from "../../utiles/instance"
export const getAllData = (SerialID: number, CarID:any, ColorID:any ) => {
    return (dispatch:any) => {
        instance.get('/api/v2-car-getImageList.html', { params: { SerialID,CarID, ColorID } }).then(res => {
            if (res.data.code === 1) {
                dispatch({ type: "GETALLDATA", data: res.data.data })
            }
        })
    }
}
export const getAllClickData = (SerialID: number, Page:number, ImageID: number, PageSize: number) => {
    return (dispatch: any) => {
        instance.get('/api//v2-car-getCategoryImageList.html', { params: { SerialID, Page, ImageID, PageSize} }).then(res => {
            if (res.data.code === 1) {
                dispatch({ type: "GETALLCLICKDATA", data: res.data.data })
            }
        })
    }
}

export const allImgFlag = (flag:boolean) => {
    return {
        type: "ALLIMGFLAG",
        flag
    }
}

export const getSwData = (SerialID: number, Page: number, ImageID: number, PageSize: number) => {
    return (dispatch: any) => {
        instance.get('/api//v2-car-getCategoryImageList.html', { params: { SerialID, Page, ImageID, PageSize } }).then(res => {
        if (res.data.code === 1) {
                dispatch({ type: "GETSWDATA", data: res.data.data })
            }
        })
    }
}

export const swFlag = (flag: boolean) => {
    return {
        type: "SWFLAG",
        flag
    }
}